//
<Pagination
  :currentPage="currentPage"
  :size="limit"
  :total="total"
  @changelimit="changelimit"
  @changecurrentPage="changecurrentPage"
></Pagination>

<template>
  <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[5, 8, 15]"
      :page-size="size"
      layout=" prev, pager, next, jumper ,-> , sizes ,total "
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    // 当前页
    currentPage: {
      type: [String, Number],
      default: 1,
      required: true,
    },
    // 一页显示数量
    size: {
      type: [String, Number],
      default: 3,
      required: true,
    },
    // 数据总量
    total: {
      type: [String, Number],
      default: 10,
      required: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    // ----------------------每页显示个数----------------------
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.$emit("changelimit", val);
    },
    // ---------------------当前是第几页-------------------
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.$emit("changecurrentPage", val);
    },
  },
};
</script>

<style>
.block {
  text-align: center;
  margin-top: 20px;
}
</style>
